{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">官方消息</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('Message/add')}"
                   data-auth-edit="{:$auth->check('Message/edit')}"
                   data-auth-delete="{:$auth->check('Message/del')}">
            </table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/html" id="picTpl">
    <img style="max-width:100px; max-height:60px;" src="{{d.img_url}}" data-image="{{d.name}}">
</script>

<script type="text/html" id="barTool">


    <a class="layui-btn layui-btn-xs" data-open='{:url("edit")}?id={{ d.id }}' data-title="查看"
       data-full="true">查看</a>

    <a href='{:url("del",["catid"=>$catid])}?ids={{ d.id }}'
       class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del">删除</a>


</script>

<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" data-href='{:url("setstate")}?id={{d.id}}' value="{{d.id}}"
           lay-skin="switch"
           lay-text="启动|关闭" lay-filter="switchStatus" {{ d.status==1 ? 'checked' : '' }}>
</script>

<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: '{:url("add")}',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
        };

        table.render({
            init: init,
            toolbar: ['refresh'],
            // toolbar: ['refresh', 'add'],
            url: '{:url("index")}',
            cols: [
                [
                    //名称 水票背景图 所属商品分类 所属商品

                    {field: 'id', align: "center",width: '10%', title: 'ID'},
                    {field: 'nickname', align: "center", width: '10%', title: '会员'},
                    {field: 'mobile', align: "center", width: '15%', title: '会员电话'},
                    {field: 'msg_cate', align: "center", width: '10%', title: '发送类型',search:false},
                    {field: 'title',align: "center", width: '20%', title: '发送标题', search:false},
                    {field: 'create_time', align: "center", width: '20%', title: '发送时间',search: 'range'},
                    {fixed: 'right', width: '15%',align: "center", title: '操作', toolbar: '#barTool'}
                ]
            ],
            page: {}
        });

        yznTable.bindevent();
        selectElement2 = document.getElementById('searchFieldset_currentTable');
        selectElement2.classList.remove("layui-hide");
        var element = document.getElementById('layui-input-search');
        element.parentNode.removeChild(element);
    });
</script>
{/block}